/* 
 * File:   Opengl.h
 * Author: Marco Ambu
 *
 * Created on October 1, 2010, 9:32 AM
 */

#ifndef _OPENGL_H
#define	_OPENGL_H

#include "ExitHandler.h"

class ReshapeHandler;
class DisplayHandler;
class KeyboardHandler;

class Opengl : public ExitHandler
{
public:
  Opengl(int* argc, char** argv);
  virtual ~Opengl();

  // C callback handlers
  static void onReshape(int width, int height);
  static void onDisplay();
  static void onKeyboard(unsigned char key, int x, int y);
  static void onSpecial(int key, int x, int y);

  // Register external callback handlers
  void registerReshapeHandler(ReshapeHandler* handler);
  void registerDisplayHandler(DisplayHandler* handler);
  void registerKeyboardHandler(KeyboardHandler* handler);

  // implement ExitHandler intf to handle application shutdown
  virtual void onExitEvent();

  // main loop (never ends!)
  void run();

private:
  static ReshapeHandler* reshapeHandler_;
  static DisplayHandler* displayHandler_;
  static KeyboardHandler* keyboardHandler_;
  static ExitHandler* exitHandler_;
};

#endif	/* _OPENGL_H */

